package main

import (
	"fmt"
	web_frame "gitee.com/MortalSC/web-frame"
)

func main() {
	engine := web_frame.New()

	userGroup := engine.Group("/user")
	userGroup.GET("/login", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "login")
	})
	userGroup.POST("/logout", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "logout")
	})

	orderGroup := engine.Group("/order")
	orderGroup.PUT("/add", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "add")
	})

	restfulGroup := engine.Group("/restful")
	restfulGroup.GET("/test", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "test get")
	})
	restfulGroup.POST("/test", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "test post")
	})
	restfulGroup.PUT("/test", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "test put")
	})
	restfulGroup.DELETE("/test", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "test delete")
	})

	treeGroup := engine.Group("/tree")
	treeGroup.GET("/add/test/:node_id", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "add tree ")
	})
	treeGroup.GET("/add/*/get", func(ctx *web_frame.Context) {
		fmt.Fprintf(ctx.Writer, "add tree -> /add/*/get")
	})

	engine.Run()
}
